﻿<!DOCTYPE HTML>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>Thông Tin Tài Khoản</title>
	<script type="text/javascript" src="../js/jquery-1.8.2.min.js"></script>
	<script type="text/javascript" src="../js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="../localization/messages_vi.js"></script>
	<style>
	input{
	background: #f5f5f5;
	border: 1px solid #cccccc;
	padding: 2px;
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
	resize: none;
}
input{
	background: #ffffff;
	border: 1px solid #3399cc;
	outline: none;
}

input{
	border: 1px solid #3399cc;
}

	</style>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#dk").validate({
				errorElement: "span",
				rules: {
					cpassword: {
						equalTo: "#password" 
					},
					min_field: { min: 5 },
					max_field: { max : 10 }, 
					range_field: { range: [4,10] }, 
					rangelength_field: { rangelength: [4,10] } 
				}
			});
		});
	</script>
	<script>
	function gt()
		{
			if(document.getElementById("gt_nu").checked)
			{
				document.getElementById("gt_nam").checked=false
				document.getElementById("hiddengt").value=1
			}
			else 
			{
				document.getElementById("gt_nam").checked=true
				document.getElementById("hiddengt").value = 0
			}
		}
	function gt2()
	{
			if(document.getElementById("gt_nam").checked)
			{
				document.getElementById("hiddengt").value = 0
				document.getElementById("gt_nu").checked=false
			}
			else 
			{
				document.getElementById("gt_nu").checked=true
				document.getElementById("hiddengt").value=1
			}
	}
	function ktdodai()
	{
		var x = document.getElementById("username").value;
		if(x.length>5)
			ktdangnhap();
		else
		{
			document.getElementById("ktdn").innerHTML = "Phải có 6 ký tự trở lên .";
			document.getElementById("submit").disabled=true;
		}
	}
	function ktdangnhap()
	{
		var ten=document.getElementById("username").value;
		if(ten.length>5)
		{
		var y = false;
		var x = 
			<?php
				include("../dbcon.php");
				$sql = mysql_query("select username from user");
				echo '[';
				$result = mysql_fetch_array($sql);
				echo '"'.$result[0].'"';
				while($result = mysql_fetch_array($sql))
				{
					echo ',';
					echo '"'.$result[0].'"';
				}
				echo ']';
			?>;
		for(var i = 0 ; i < x.length ; i++)
			if(ten==x[i])
				y=true;
		if(y)
			document.getElementById("ktdn").innerHTML="Tên đăng nhập đã tồn tại .";
		else 
			document.getElementById("ktdn").innerHTML="Tên đăng nhập có thể sử dụng .";
		}
		else document.getElementById("ktdn").innerHTML = "";
	}
	</script>
</head>
<body>
<div id="container" class="bgdk">
    <form id="dk" method="post" action="../libs/xulydangky.php" enctype="multipart/form-data" class="contact-form" >
		<center><h3>Thông tin đăng ký</h3></center>
		<table>
		<tr>
		<td width="120px" align="left" style="padding-left:20px;">Tên đăng nhập : </td>
		<td style="float:left"><input class="required" minlength="6" maxlength="10" onchange="ktdangnhap()" id="username" name="username" type="text" tabindex="1"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Mật khẩu : </td>
		<td style="float:left"><input class="required" minlength="6" maxlength="20" id="password" name="password" type="password" class="text" tabindex="2"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Nhập lại mật khẩu : </td>
		<td style="float:left"><input class="required" name="cpassword" maxlength="20" type="password" class="text" tabindex="3"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Họ : </td>
		<td style="float:left"><input class="required" id="ho" name="ho" maxlength="50" type="text" class="text" tabindex="4"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Tên lót : </td>
		<td style="float:left"><input class="required" id="tenlot" name="tenlot" maxlength="50" type="text" class="text" tabindex="5"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Tên : </td>
		<td style="float:left"><input class="required" id="ten" name="ten" maxlength="50" type="text" class="text" tabindex="6"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Địa chỉ email : </td>
		<td style="float:left"><input class="required email" id="email" name="email" maxlength="50" type="text" class="text" tabindex="7"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>
		
		<tr>
		<td width="120px" align="left" style="padding-left:20px">Địa chỉ : </td>
		<td style="float:left"><input class="required" id="diachi" name="diachi" maxlength="100" type="text" class="text" tabindex="8"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Số điện thoại : </td>
		<td style="float:left"><input id="mobi" class="digits" maxlength="11" name="sdt" type="text" class="text" tabindex="9"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Giới tính : </td>
		<td style="float:left">Nam <input type="checkbox" tabindex="9" name="gt[]" id="gt_nam" onClick="gt2()" checked="checked"> 
							Nữ <input type="checkbox" onClick="gt()" tabindex="10" name="gt[]" id="gt_nu">
								<input type="hidden" name="hiddengt" id="hiddengt" value="0"></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Câu hỏi bí mật : </td>
		<td style="float:left"><input class="required" maxlength="20" id="cauhoi" name="cauhoi" type="text" class="text" tabindex="11" /></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Câu trả lời : </td>
		<td style="float:left"><input class="required" maxlength="20" id="traloi" name="traloi" type="text" class="text" tabindex="12" /></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Hình ảnh xác nhận : </td>
		<td style="float:left"><img src="../libs/captcha.php"/></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px">Mã xác nhận : </td>
		<td style="float:left"><input class="required" type="text" name="txtCaptcha" maxlength="10" tabindex="13"/></td>
		<td style="padding-left:10px; color:red;"><span class="rq"> * </span></td>
		</tr>

		<tr>
		<td width="120px" align="left" style="padding-left:20px"></td>
		<td style="float:left; padding-left:20px;"><input name="send" class="btTxt submit" type="submit" value="Đăng ký" id="submit" style="padding: 5px;" /></td>
		</tr>
		</table>	
	</form>
</div>
</body>
</html>